home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 03 Pathfinding with Astar / 04 Higgins / Listing3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-09  |  1.0 KB  |  29 lines

  1. /* Copyright (C) Dan Higgins, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Dan Higgins, 2001"
  9.  */
  10.  
  11. // Methods on the A* storage class that use these flags would include:
  12.  
  13. // Gets the flag from the array
  14. inline AStarNodeStatusFlags* GetFlag(long inX, long inY)    
  15. { //add your own ASSERT check to ensure no array overruns.
  16.   return this->mFlags + ((inX * this->mArrayMax) + inY); }
  17.  
  18. // returns true if the node is closed
  19. inline bool GetIsClosed(AStarNodeStatusFlags* inFlag) const
  20. { return ((*inFlag & kClosed) != kClear); }
  21.  
  22. // clears the 'passable status' flag
  23. inline void ClearPassableFlag(AStarNodeStatusFlags* inFlag)
  24. { *inFlag &= ~kPassable; }
  25.  
  26. // sets the 'open status' flag
  27. inline void SetOpenFlag(AStarNodeStatusFlags* inFlag)
  28. { *inFlag |= kOpen; }
  29.